package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.LowCodeJsFileModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.domain.dao.LowCodeJsFileDao;
import com.xbongbong.pro.domain.entity.LowCodeJsFileEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/03/03 16:28
 */
@Service("lowCodeJsFileModel")
public class LowCodeJsFileModelImpl implements LowCodeJsFileModel {
    @Resource
    private LowCodeJsFileDao lowCodeJsFileDao;

    @Override
    public Integer insert(LowCodeJsFileEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return lowCodeJsFileDao.insert(entity);
    }

    @Override
    public Integer update(LowCodeJsFileEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setUpdateTime(now);
        return lowCodeJsFileDao.update(entity);
    }

    @Override
    public List<LowCodeJsFileEntity> findEntitys(Map<String, Object> param) {
        return lowCodeJsFileDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return lowCodeJsFileDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer deleteByFormId(Long formId, String corpid, Integer businessType) {
        return lowCodeJsFileDao.deleteByFormId(formId, corpid, businessType);
    }

    @Override
    public void insertBatch(List<LowCodeJsFileEntity> list) {
        lowCodeJsFileDao.insertBatch(list);
    }

    @Override
    public Integer deleteBatch(List<Long> list, String corpid) {
        return lowCodeJsFileDao.deleteBatch(list, corpid);
    }

    @Override
    public Integer updateBatch(List<LowCodeJsFileEntity> lowCodeJsFileEntityList, String corpid) {
        return lowCodeJsFileDao.updateBatch(lowCodeJsFileEntityList, corpid);
    }
}
